package com.cjq.goods.service.impl;

import com.cjq.common.domain.Goods;
import com.cjq.common.domain.request.GoodsReq;
import com.cjq.common.domain.response.GoodsRes;
import com.cjq.common.result.Result;
import com.cjq.goods.mapper.GoodsMapper;
import com.cjq.goods.service.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class GoodsServiceImpl implements GoodsService {
    @Autowired
    private GoodsMapper goodsMapper;

    @Override
    public List<GoodsRes> goodsList(GoodsReq goodsReq) {
        return goodsMapper.goodsList(goodsReq);
    }

    @Override
    public Result insert(Goods goods) {
         goodsMapper.insert(goods);
         return Result.success();
    }

    @Override
    public Result update(Goods goods) {
        goodsMapper.update(goods);
        return Result.success();
    }

    @Override
    public Result updateStatus(String goodsId) {
        goodsMapper.updateStatus(goodsId);
        return Result.success();
    }

    @Override
    public Result del(String goodsId) {
        goodsMapper.del(goodsId);
        return Result.success();
    }

    @Override
    public Result batchDel(List<Integer> goodsIds) {
        goodsMapper.batchDel(goodsIds);
        return Result.success();
    }

}
